package com.project.dao;

import com.project.entity.UserRoleEntity;
import dto.UserRoleDto;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * @author lyl
 * description:
 */
public interface IUserRoleDao extends CrudRepository<UserRoleEntity, Long> {


    @Query("select new dto.UserRoleDto(userEntity.username,userEntity.age,roleEntity.roleName) from UserRoleEntity " +
            "where userEntity.username like concat('%',?1,'%') and roleEntity.roleName like concat('%',?2,'%')")
    List<UserRoleDto> findUserHQLDto(String username, String roleName);
}
